#pragma once

#include "head.h"

//! 主界面
class UIMain : public UI::Scene
{
public:
	UIMain()
	{
		UI::Panel* _panelBg = CreatePanel("bg");
		{
			UI::Sprite* ui_spr = UI::Sprite::Create(
				g_factory->CreateSprite("menu_bg"), {}, UI::Sprite::Mode::RATIO_W);
			_panelBg->Add(ui_spr);
		}
		//
		UI::Panel* _panel = CreatePanel("title");
		_panel->SetPosScale({ 0.15f, 0.15f });
		
		{
			gcText txt = g_factory->CreateText(TR_FONT_ID_ART, 72);
			txt->SetString(TR_STR_NAME);
			UI::Text* ui_txt = UI::Text::Create(txt);
			_panel->Add(ui_txt);
		}
		//
		_panelMenu = CreatePanel("menu");
		_panelMenu->SetLocator(createLocatorY(50));
		_panelMenu->SetPosPixel({ 20, 180 });
		_panelMenu->SetPosScale({ 0.15f, 0.15f });

		std::array vec_menu = { "开始占卜", "程序设置", "结束程序" };

		for(auto& iter : vec_menu)
		{
			UI::ButtonSprite* btn = g_ui->CreateButtonSpriteDefault();
			btn->SetSound("btn_click", "btn_over");
			btn->SetString(iter);
			_panelMenu->Add(btn);
		}
	}

	virtual void Update() override;
private:
	UI::Panel* _panelMenu;
};